<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Peripheral I/O</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="edit68k.css" rel="stylesheet" type="text/css">
</head>

<body class="text">
<p class="heading">Sim68K Peripheral I/O<hr noshade></p>
<p></p>
<p>TRAP #15 is used for I/O. &nbsp;Put the task number in D0.</p>
<p> The output screen resolution is adjustable via Task 33. The top 
left corner of the window is position 0,0</p>
<b>&nbsp;Task
</b>
<table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="697">
  <tr>
    <td width="6%" class="text">
	<p><b>&nbsp;60</b></td>
    <td width="94%" class="text">
      <p>
		&nbsp; Enable/Disable mouse IRQ<br>
		&nbsp; An IRQ is created when a mouse button 
		is pressed or released in the output window.<br>
&nbsp; D1.W High Byte = IRQ level (1-7), 0 to turn off<br>
&nbsp; D1.W Low Byte = 1 in the corresponding bit to indicate which mouse event triggers IRQ where:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
		Bit2 = Move, Bit1 = button Up, Bit0 = button Down<br>
&nbsp; (Example D1.W = $0107, Enable mouse IRQ level 1 for Move, button Up and 
		button Down)<br>
&nbsp; (Example D1.W = $0002, Disable mouse IRQ for button Up)</td>
  </tr>
  <tr>
    <td width="6%" class="text">
	<b>&nbsp;61</b></td>
    <td width="94%" class="text">
	&nbsp; Mouse Read<br>
&nbsp; Pre: D1.B = 00 to read current state of mouse<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	= 01 to read mouse up state<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	= 02 to read mouse down state<br>
&nbsp; Post: The mouse data is contained in the following registers:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D0 as bits = Ctrl, Alt, Shift, 
	Double, Middle, Right, Left<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Left is Bit0, 
	Right is Bit 1 etc. 1 = true, 0 = false<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Shift, Alt, 
	Ctrl represent the state of the corresponding keys.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D1.L = 16 bits Y, 16 bits X in 
	pixel coordinates. (0,0 is top left)</td>
  </tr>
  <tr>
    <td width="6%" class="text">
	<b>&nbsp;62</b></td>
    <td width="94%" class="text">
      &nbsp; Enable/Disable keyboard IRQ<br>
		&nbsp; An IRQ is created when a key 
		is pressed or released in the output window.<br>
&nbsp; D1.W High Byte = IRQ level (1-7), 0 to turn off<br>
&nbsp; D1.W Low Byte = 1 in the corresponding bit to indicate which keyboard event triggers IRQ where:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
		Bit1 = key Up, Bit0 = key Down<br>
&nbsp; (Example D1.W = $0103, Enable keyboard IRQ level 1 for key Up and key Down)<br>
&nbsp; (Example D1.W = $0002, Disable keyboard IRQ for key Up)<br>
&nbsp; Read the last key down or key up with trap <a href="textio.htm">task #19</a>.</td>
  	</tr>
  </table>
</body>
</html>
